package com.zb.entity.dto;

import com.zb.entity.ZjAdmRole;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/7/11 0011
 **/
@Data
@ApiModel("角色列表对象")
public class RoleList {
    @ApiModelProperty(value = "主健ID")
    private Long id;

    @ApiModelProperty(value = "角色名称")
    private String name;

    @ApiModelProperty(value = "角色编码")
    private String code;

    @ApiModelProperty(value = "是否超管：false-否，true-是")
    private Boolean admin;

    @ApiModelProperty(value = "是否禁用：false-否，true-是")
    private Boolean disabled;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    public static RoleList beanToRole(ZjAdmRole admRole) {
        RoleList r = new RoleList();
        BeanUtils.copyProperties(admRole, r);
        r.setCreateTime(admRole.getGmtCreate());
        r.setUpdateTime(admRole.getGmtUpdate());
        return r;
    }
}
